﻿using DevExpress.Persistent.BaseImpl;

namespace EasyXaf.EntityDesigner.BusinessObjects.Entities.EntityViews;

/// <summary>
/// 实体视图
/// </summary>
public partial class EntityView : BaseObject
{
    private partial string GetDisplayName()
    {
        var viewId = ViewId;
        var viewCaption = ViewCaption;

        if (string.IsNullOrWhiteSpace(viewId))
        {
            viewId = $"{Entity.Name}_{ViewType}";
        }

        if (string.IsNullOrWhiteSpace(viewCaption))
        {
            viewCaption = Entity.Caption;
        }

        if (!string.IsNullOrWhiteSpace(viewCaption))
        {
            return $"{viewId}({viewCaption})";
        }

        return viewId;
    }
}
